package cn.psh.system.listener;

import cn.psh.system.service.impl.PermissionServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
@Slf4j
public class PermissionScanInitListener implements ServletContextListener {

    @Autowired
    private PermissionServiceImpl permissionService;

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        System.out.println("开始");
        permissionService.scanPermission();
        System.out.println("结束");

    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
